//
//  YCLeftViewVC.m
//  KuaiYi
//
//  Created by 刘胤辰 on 16/7/5.
//  Copyright © 2016年 it.com. All rights reserved.
//
#define MAS_SHORTHAND

#define MAS_SHORTHAND_GLOBALS

#import "YCLeftViewVC.h"
#import "YCTableView.h"
#import <Masonry.h>

@interface YCLeftViewVC ()

@end

@implementation YCLeftViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    
    //创建上面的视图
    UIImageView *headView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width*0.81, 150)];
    
    [self.view addSubview:headView];

    UIImageView *headImage=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"h2"]];
    
    CGFloat yImage=40;
    CGFloat xImage=20;
    headImage.frame=CGRectMake(xImage, yImage, 80, 80);
    headImage.layer.cornerRadius=40;
    headImage.layer.masksToBounds=YES;
    
    UILabel *nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(headImage.frame.size.width+xImage*2, yImage+5, 100, 20)];
    nameLabel.text=@"王二才";
    
    UILabel *detaiLabel=[[UILabel alloc]initWithFrame:CGRectMake(headImage.frame.size.width+xImage*2, yImage+headImage.frame.size.height-25, 150, 20)];
    
    detaiLabel.text=@"查看个人资料";
    detaiLabel.font=[UIFont systemFontOfSize:14];
    detaiLabel.textColor=[UIColor darkGrayColor];
    
    [headView addSubview:nameLabel];
    [headView addSubview:detaiLabel];
    [headView addSubview:headImage];

    
    
    
    
    
    
    
    //创建tableView
    YCTableView *tab=[[YCTableView alloc]initWithFrame:CGRectMake(0, headView.frame.size.height, headView.frame.size.width, self.view.frame.size.height-headView.frame.size.height) style:UITableViewStyleGrouped];
    
//    [headView makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.top.left.offset(20);
//        
//        make.right.offset(-20);
//        
//        make.height.equalTo(40);
//        
//    }];
  
    headView.image=[UIImage imageNamed:@"nav"];
    
    [self.view addSubview:tab];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
